<template>
  <view class="chooseItem">
    <navigator :url="'/pages/classList/classList?id='+item._id+'&name='+item.name" class="box" v-if="!isMore">
      <image class="pic" :src="item.picurl" mode="aspectFill"></image>
      <div class="mask">{{item.name}}</div>
      <div class="tab">{{formatTimeDiff(item.updateTime)}}</div>
    </navigator>
    <navigator url="/pages/classify/classify" open-type="reLaunch" class="box more" v-else>
      <image class="pic" :src="item.picurl" mode="aspectFill"></image>
      <div class="mask">
        <uni-icons type="more-filled" size="34" color="#fff"></uni-icons>
        <div class="text">更多</div>
      </div>
    </navigator>
  </view>
</template>

<script setup>
	import {formatTimeDiff} from '../../utils/time.js'
defineProps({
  isMore:{
    type:Boolean,
    default:false
  },
  item:{
	  type:Object,
	  default(){
		  return {
			  name:"默认名称",
			  picurl:"../../common/images/classify1.jpg",
			  updateTime:Date.now()-1000*60*60*5
		  }
	  }
  }
})
</script>

<style lang="scss" scoped>
.chooseItem{
  .box{
    position: relative;
    height: 340rpx;
    border-radius: 10rpx;
    overflow: hidden;
    .pic{
      width: 100%;
      height: 100%;
    }
    .mask{
      position: absolute;
      bottom: 0;
      left: 0;
      width: 100%;
      height: 70rpx;
      font-size: 30rpx;
      background-color: rgba(0, 0, 0, .2);
      color: #fff;
      display: flex;
      justify-content: center;
      align-items: center;
      // 模糊滤镜
      backdrop-filter: blur(20rpx);
      font-weight: 500;
    }
    .tab{
      position: absolute;
      font-size: 22rpx;
      left: 0;
      top: 0;
      background: rgba(250, 129, 90, .7);
      backdrop-filter: blur(20rpx);
      color: #fff;
      padding: 5rpx 15rpx;
      border-radius: 0 0 10rpx 0;
    }
  }
  .box.more{
    .mask{
      width: 100%;
      height: 100%;
      flex-direction: column;
    }
    .text{
      font-size: 28rpx;
    }
  }
}
</style>